//
//  NSString+URLEncodeString.m
//  Avatar
//
//  Created by Kai on 8/25/10.
//  Copyright 2010 NONAME STUDIO. All rights reserved.
//

#import "NSString+URLEncodeString.h"

@implementation NSString (URLEncode) 

// URL encode a string 
+ (NSString *)URLEncodeString:(NSString *)string { 
    
	NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR("% '\"?=&+<>;:-"), kCFStringEncodingUTF8); 
	
    return [result autorelease]; 
} 

// Helper function 
- (NSString *)URLEncodeString { 
    return [NSString URLEncodeString:self]; 
} 

@end  